package jiggle;

public class InverseSquareVertexVertexOverlapConstraint extends AbstractForceLaw implements Constraint {

	public InverseSquareVertexVertexOverlapConstraint (Graph g, double k) {
		super (g, k);
	}

	@Override
    public double pairwiseWeights(double pref, double curr) {
	    if (curr>pref) return 0;
		return cube(pref / curr) * -1;
	}


	@Override
    public void apply(double[][] negativeGradient) {
		applyForVertexPairs(negativeGradient);
    }

}